//
//  Sensor.m
//  NXTRemoteController
//
//  Created by naceka on 24.03.12.
//  Copyright 2012 __MyCompanyName__. All rights reserved.
//

#import "Sensor.h"


@implementation Sensor

- (Sensor *) initWithType:(enum Sensor_Type) t andMode:(enum Sensor_Mode) m {
	self = [super init];
	type = t;
	mode = m;
	return self;
}

- (enum Sensor_Type) getType {
	return type;
}

- (NSString *) getTypeString {
	NSMutableArray * arr = [[[NSMutableArray alloc] initWithObjects:@"Нет", @"Такт", @"Temp", @"Refl",
							@"Angle", @"Light active", @"Цвет", @"Db", @"Звук", @"Custom", @"LS", @"Ульразвук", @"no idea", nil] autorelease];
	NSString * retval = [NSString stringWithFormat:@"%@", [arr objectAtIndex:type]];
	return retval;
}

- (enum Sensor_Mode) getMode {
	return mode;
}

- (void) setData:(uint8_t) d1 :(uint8_t) d2 {
	data[0] = d1;
	data[1] = d2;
}

- (NSString *) getData {
	return [[NSString alloc] initWithFormat:@"%d %d", (int)data[0], (int)data[1]];
}

@end
